<?php 
	$table = 'gallery';	
	
	$id = $_GET['id']; 	
	$record = $conn -> get_all_data($table,$id);	
?>

<div id="demo"></div>
<div class="alert alert-info hide">
    <button class="close" data-dismiss="alert">×</button>
    Thay đổi hình ảnh thành công
</div>
<script>        
    function createUploader(){            
        var uploader = new qq.FileUploader({
            element: document.getElementById('demo'),
            multiple : false,
            action: 'ajax/uploadfile.php',
            params : {
            	type : 'edit',
            	group : 'gallery',
            	id : <?=$record['id'] ?>
            },
            sizeLimit: 5*1024*1024, // max size
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
            onComplete: function(id, fileName, responseJSON){
            	$('#url_image').attr('src', '../uploads/gallery/'+responseJSON.filename);
            	$('.alert-info').show();
            },
        });           
    }        
    window.onload = createUploader;     
</script> 
<div id="alert"></div>
<form class="form-horizontal" id="news-form" method="POST">	
	<fieldset>
		<div class="control-group">
			<label class="control-label">Hình hiện tại</label>
			<div class="controls">
				<img id="url_image" width="300" height="300" src="<?=$conn -> BASE_URL  ?>/uploads/gallery/<?=$record['url_image']  ?>" /> 
			</div>
		</div>
	</fieldset>
</form>